package cn.hiapi.shopkeeper.entity.activity;

import cn.hiapi.basic.entity.BasicEntity;
import cn.hiapi.basic.serializer.LongToStringSerializer;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.math.BigDecimal;

/**
 * @author AdinZ
 * @date 2022/12/13 0:16
 */
@Entity
@Table(name = "hiapi_shopkeeper_activity_lottery_item")
@ApiModel(description = "抽奖活动奖品")
@Getter
@Setter
public class ActivityLotteryItem extends BasicEntity {
    @Id
    @GeneratedValue(generator = "snowflake")
    @GenericGenerator(name = "snowflake", strategy = "cn.hiapi.basic.id.SnowflakeId")
    @JSONField(serializeUsing = LongToStringSerializer.class)
    private Long id;
    @ApiModelProperty("活动id")
    private long aid;
    @ApiModelProperty("抽奖活动id")
    private long lid;
    @ApiModelProperty("奖品数量")
    private int stockNum;

    @ApiModelProperty("唯一id")
    private long itemId;

    @ApiModelProperty("商品名称")
    private String title;
    @ApiModelProperty("商品图片")
    private String thumb;

    @ApiModelProperty("商品价格")
    @Column(columnDefinition = "decimal(10,2)")
    private BigDecimal price = BigDecimal.ZERO;
    @ApiModelProperty("中奖概率")
    @Column(columnDefinition = "decimal(10,2)")
    private BigDecimal rate = BigDecimal.ZERO;

    @ApiModelProperty("奖品类型0 商品,1红包, 9谢谢惠顾")
    private int type;


}
